package com.fz;

import com.entity.Student;
import com.entity.mapper.StudentMapper;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * Created by 2429916391@qq.com on 2017/2/16 17:10.
 */
public class Demo {
    @Test
    public void dd(){
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
        //studentMapper->compont("stma")==stma
        StudentMapper sm = ctx.getBean("stma",StudentMapper.class);
        List<Student> list = sm.queryAll();
        for (Student s:list){
            System.out.println(s.getName());
        }
        //输出bean结果ds,sf,session,jdbcTemplate,stma
        for (String ss:ctx.getBeanDefinitionNames()){
            System.out.println(ss);
        }

        ctx.close();

    }
}
